

package com.hazelcast.jet.impl.metrics;

import com.hazelcast.jet.core.metrics.Metric;
import com.hazelcast.jet.core.metrics.Unit;
import com.hazelcast.jet.impl.execution.init.Contexts;

public final class MetricsImpl {

    private MetricsImpl() {
    }

    public static Metric metric(String name, Unit unit) {
        return getMetricsContext().metric(name, unit);
    }

    public static Metric threadSafeMetric(String name, Unit unit) {
        return getMetricsContext().threadSafeMetric(name, unit);
    }

    private static MetricsContext getMetricsContext() {
        return Contexts.getCastedThreadContext().metricsContext();
    }
}
